<?php
defined('_JEXEC') or die;

JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', 'select');

$items=$this->items;
$total = JRequest::getVar('total');
$pagination = JRequest::getVar('pagination');
?>

<form action="<?php echo JRoute::_('index.php?option=com_dmdaotao&controller=linhvucnckh'); ?>" method="post" name="adminForm" id="adminForm">
	<?php if (!empty( $this->sidebar)) : ?>
	<div id="j-sidebar-container" class="span2">
	<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="span10">
		<?php else : ?>
			<div id="j-main-container">
		<?php endif;?>
	<div style="clear:both;padding:5px"></div>
    <table class="table table-striped" id="articleList">
        <thead>
            <tr>
                <th class="nowrap center">
                    <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $items ); ?>);" />
                </th>
                <th class="title">Tên lĩnh vực</th>
                <th class="nowrap center">Thứ tự</th>
                <th class="nowrap center">Trạng thái</th>
                <th class="nowrap center">id</th>
            </tr>
        </thead>
         <tfoot>
			<tr>
				<td colspan="6">
<!-- 					echo $pagination->getListFooter(); ?> -->
				</td>
			</tr>
		</tfoot>
        <?php
        $k = 0;
        for ($i=0, $n = count( $items ); $i < $n; $i++)
        {
            $row = $items[$i];
			$checked 	= JHTML::_('grid.id',$i, $row->id);
            $link 		= JRoute::_( 'index.php?option=com_dmdaotao&controller=linhvucnckh&task=edit&id='.$row->id );
            $published 	= JHTML::_('jgrid.published', $row->status, $i );
            ?>
        <tr class="<?php echo "row$k"; ?>">
            <td style="width: 30px;" class="center">
                <?php echo $checked; ?>
            </td>
           <td>
           		 <a href="<?php echo $link; ?>"><?php echo $row->name; ?></a>
           </td>
           <td  style="width: 30px;" class="center">
                <?php  echo $row->order;?>
            </td>
           <td class="center hidden-phone"  style="width: 60px;" >
				<span class="editlinktip hasTip" >
				<?php echo $published;?>
				</span>
			</td>
			<td  style="width: 30px;" class="center">
                <?php  echo $row->id;?>
            </td>
        </tr>
        <?php
        $k = 1 - $k;
    }
    unset($this->colid);
    ?>
    </table>
    <input type="hidden" name="option" value="com_dmdaotao" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="boxchecked" value="0" />
    <input type="hidden" name="controller" value="linhvucnckh" />
    </div>
    </div>
</form>
<script>
function checkAll(ele){
	var checkboxes = document.getElementsByTagName('input'), val = null;    
    for (var i = 0; i < checkboxes.length; i++)
    {
        if (checkboxes[i].type == 'checkbox')
        {
            if (val === null) val = checkboxes[i].checked;
            checkboxes[i].checked = val;
        };
    };
};
</script>